import { createRouter, createWebHistory } from "vue-router";
import Layout from "../views/layout/layout.vue";
const routes = [
  {
    path: "/",
    name: "layout",
    component: Layout,
    redirect: "/home",
    children: [
      {
        path: "/home",
        name: "home",
        component: () =>
        import(/* webpackChunkName: "home" */ "../views/home/index.vue"),
    
      },
      {
        path: "/ui",
        name: "ui",
        component: () =>
          import(/* webpackChunkName: "ui" */ "../views/ui/index.vue"),
      },
      {
        path: "/template",
        name: "template",
        component: () =>
          import(/* webpackChunkName: "template" */ "../views/ui/template.vue"),
      },
      {
        path: "/tableList/:modelCode",
        name: "tableList",
        component: () =>
          import(/* webpackChunkName: "tableList" */ "../views/tableList/index.vue"),
      },
      {
        path: "/demo/vscroll",
        name: "demoVscroll",
        component: () =>
          import(/* webpackChunkName: "vscroll" */ "../views/demo/vscroll.vue"),
      },

      {
        path: "/demo",
        name: "demo",
        component: () => import(/* webpackChunkName: "demo" */ "../views/demo/layout.vue"),
        children: [
          {
            path: "index",
            name: "demo-index",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/index.vue"),
          },
          {
            path: "form",
            name: "demo-form",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form.vue"),
          },
          {
            path: "form/input",
            name: "form-input",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/input.vue"),
          },
          {
            path: "form/radio",
            name: "form-radio",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/radio.vue"),
          },
          {
            path: "form/checkbox",
            name: "form-checkbox",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/checkbox.vue"),
          },
          {
            path: "form/switch",
            name: "form-switch",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/switch.vue"),
          },
          {
            path: "form/select",
            name: "form-select",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/select.vue"),
          },
          {
            path: "form/selectModel",
            name: "form-selectModel",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/selectModel.vue"),
          },
          {
            path: "form/textarea",
            name: "form-textarea",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/textarea.vue"),
          },
          {
            path: "form/editer",
            name: "form-editer",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/editer.vue"),
          },
          {
            path: "form/uploadFile",
            name: "form-uploadFile",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/uploadFile.vue"),
          },
          {
            path: "form/uploadImage",
            name: "form-uploadImage",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/uploadImage.vue"),
          },
          {
            path: "form/datePicker",
            name: "form-datePicker",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/datePicker.vue"),
          },
          {
            path: "form/datetimePicker",
            name: "form-datetimePicker",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/datetimePicker.vue"),
          },
          {
            path: "form/treeSelect",
            name: "form-treeSelect",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/treeSelect.vue"),
          },
          {
            path: "form/selectTable",
            name: "form-selectTable",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/selectTable.vue"),
          },


          {
            path: "business/list",
            name: "business-list",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/business/list.vue"),
          },
          {
            path: "business/button",
            name: "business-button",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/business/button.vue"),
          },
          {
            path: "form/form",
            name: "form-form",
            component: () =>
              import(/* webpackChunkName: "demo-index" */ "../views/demo/form/form.vue"),
          }
          
          
        ]
      }
    ],
  },
  
  {
    path: "/login",
    name: "login",
    component: () =>
    import(/* webpackChunkName: "login" */ "../views/login/index.vue"),

  },
  
  {
    path: "/map",
    name: "map",
    component: () =>
    import(/* webpackChunkName: "map" */ "../views/map/index.vue"),

  },
  {
    path: '/error/404',
    name: "error404",
    component: () => import('@/views/error/404.vue'),
  },
  {
    path: '/:pathMatch(.*)*',
    redirect: "/error/404"
  }
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
